<script lang="ts">
import {defineComponent} from "vue"
import {timestampFormat} from "@/units/time";

export default defineComponent({
  props: {
    format: {
      type: String,
      default: "Y-m-d H:i:s"
    },
    time: {
      type: [String, Number, Date],
      default: () => new Date
    }
  },
  setup(props) {
    return () => props.time ? timestampFormat(props.format, props.time) : ''
  }
})
</script>